#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QPainter>
#include <QPaintEvent>
#include <QMouseEvent>
#include <QVector>
#include "chessitem.h"
#include <QDebug>
#include <QMessageBox>
#include <QPushButton>
#include <QFont>
#include <QLabel>

#define ROW 15   //行
#define COL 15   //列
#define xsize 80
#define ysize 80

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
protected:
    void paintEvent(QPaintEvent *);
    void mousePressEvent(QMouseEvent * event);
private:
    void InitUI();
    void drawchessboard();
    void drawhandchess();
    void drawchessitem();
    void drawchessplace(QPainter &painter,QPoint &point);
    int checkchess(ChessItem item,QPoint pt);
private slots:
    void chessback();
private:
    Ui::MainWindow *ui;
    bool handchess_color;
    QVector<ChessItem> p_chessItem;//定义棋子集合
    QPushButton *button;
    QLabel *label;
    QLabel *label_2;
};
#endif // MAINWINDOW_H
